<template>
	<view class="page">
		<view class="goods-info">
			<view class="cover">
				<image :src="details.hxcode_proimg" mode=""></image>
			</view>
			<view class="exp">
				<view class="name">
					<text>{{ details.hxcode_proname }}</text>
				</view>
				<view class="desc">
					<text>{{ details.usetime || '长期有效' }}</text>
				</view>
				<view class="price">
					<text>¥{{ details.hxcode_price }}</text>
				</view>
			</view>
		</view>
		
		<view class="qrcode-box">
			<view class="thead">
				<text>到店核销</text>
			</view>
			<view class="tbody">
				<view class="qrcode">
					<image :src="details.code_img" mode=""></image>
				</view>
				<view class="label">
					<text>券码：</text>
					<text>{{ details.hxcode }}</text>
				</view>
				<view
					class="copy"
					@click="handleCopy(details.hxcode)">
					<image src="https://img.2024csnl.com/static/2.x/a78.png" mode=""></image>
					<text>点击复制券码</text>
				</view>
			</view>
		</view>
		
		<view class="shop-list" v-if="false">
			<view class="thead">
				<view class="title">
					<text>适用门店</text>
					<text class="gray">(1234家)</text>
				</view>
				<view class="link">
					<text>查看全部门店</text>
					<image src="https://img.2024csnl.com/static/2.x/a27.png" mode=""></image>
				</view>
			</view>
			<view class="tbody">
				<view
					v-for="(item, index) in 11"
					:key="index"
					class="item">
					<view class="cell">
						<view class="cover">
							<image src="" mode=""></image>
						</view>
						<view class="exp">
							<view class="name">
								<text>商铺名称商铺名称商铺名称</text>
							</view>
							<view class="desc">
								<text>营业时间 | 09:00-20:00</text>
							</view>
							<view class="ft">
								<view class="juli">
									<image src="https://img.2024csnl.com/static/2.x/a79.png" mode=""></image>
									<text>距您12.35km</text>
								</view>
								<view class="icons">
									<view class="icon">
										<image src="https://img.2024csnl.com/static/2.x/a80.png" mode=""></image>
										<text>导航</text>
									</view>
									<view class="icon">
										<image src="https://img.2024csnl.com/static/2.x/a81.png" mode=""></image>
										<text>电话</text>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="">
			
		</view>
		
	</view>
</template>

<script>
	import { $get, $post } from "@/api/index.js"
	
	export default {
		data() {
			return {
				option: {},
				details: {}
			}
		},
		onLoad(option) {
			this.option = option;
			this.getDetails()
		},
		methods: {
			// 详情
			async getDetails () {
				const { id } = this.option
				const res = await $get('s=ApiZwyRequest/hexiaocodedetail', {
					id
				})
				const { msg, data, status } = res.data
				if (status == 1) {
					this.details = data
				}
			},
			// 复制
			handleCopy (text) {
				this.copyText(text)
			}
		}
	}
</script>

<style lang="less" scoped>
	.page {
		min-height: 100vh;
		background: #f8f8f8;
		padding: 20rpx 0;
	}
	
	.goods-info {
		position: relative;
		margin: 0 20rpx 0;
		background: #fff;
		padding: 20rpx;
		border-radius: 20rpx;
		display: flex;
		align-items: center;
		.cover {
			image {
				display: block;
				width: 170rpx;
				height: 170rpx;
				border-radius: 10rpx;
				background-color: #eee;
			}
		}
		.exp {
			flex: 1;
			margin: 0 0 0 20rpx;
			overflow: hidden;
			.name {
				display: flex;
				align-items: center;
				text {
					flex: 1;
					line-height: 40rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					font-size: 28rpx;
				}
				image {
					display: block;
					width: 30rpx;
					height: 30rpx;
				}
			}
			.desc {
				margin: 5rpx 0 5rpx;
				line-height: 40rpx;
				color: #999;
			}
			.price {
				line-height: 40rpx;
				color: #FF3F3F;
			}
		}
	}
	
	.qrcode-box {
		position: relative;
		margin: 20rpx;
		background: #fff;
		border-radius: 20rpx;
		.thead {
			line-height: 100rpx;
			margin: 0 20rpx;
			border-bottom: 1px solid #eee;
			font-size: 34rpx;
			font-weight: bold;
		}
		.tbody {
			position: relative;
			text-align: center;
			padding: 80rpx;
			.qrcode {
				image {
					width: 400rpx;
					height: 400rpx;
					background: #eee;
					border-radius: 20rpx;
				}
			}
			.label {
				margin-top: 40rpx;
				line-height: 80rpx;
				font-size: 38rpx;
				font-weight: bold;
			}
			.copy {
				line-height: 80rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				image {
					display: block;
					width: 34rpx;
					height: 34rpx;
				}
				text {
					margin-left: 10rpx;
					font-size: 30rpx;
					color: #7B61FF;
				}
			}
		}
	}
	
	.shop-list {
		margin: 20rpx;
		position: relative;
		background: #fff;
		border-radius: 20rpx;
		.thead {
			line-height: 100rpx;
			margin: 0 20rpx;
			border-bottom: 1px solid #eee;
			display: flex;
			align-items: center;
			.title {
				flex: 1;
				font-size: 30rpx;
				font-weight: bold;
				.gray {
					color: #999;
					font-weight: normal;
					margin-left: 10rpx;
				}
			}
			.link {
				color: #999;
				display: flex;
				align-items: center;
				font-size: 28rpx;
				image {
					display: block;
					width: 30rpx;
					height: 30rpx;
				}
			}
		}
		.tbody {
			overflow: hidden;
			.item {
				margin: 20rpx;
			}
			.cell {
				position: relative;
				display: flex;
				align-items: center;
			}
			.cover {
				image {
					display: block;
					width: 160rpx;
					height: 160rpx;
					background: #eee;
					border-radius: 20rpx;
				}
			}
			.exp {
				flex: 1;
				margin: 0 0 0 20rpx;
			}
			.name {
				line-height: 40rpx;
				font-size: 28rpx;
				font-weight: bold;
				overflow: hidden;
				white-space: nowrap;
				overflow: hidden;
			}
			.desc {
				line-height: 40rpx;
				color: #999;
			}
			.ft {
				display: flex;
				align-items: flex-end;
				height: 80rpx;
			}
			.juli {
				flex: 1;
				display: flex;
				align-items: center;
				line-height: 40rpx;
				image {
					display: block;
					width: 30rpx;
					height: 30rpx;
					margin-right: 10rpx;
				}
				text {
					color: #999;
				}
			}
			.icons {
				display: flex;
				align-items: center;
				.icon {
					position: relative;
					margin: 0 10rpx;
					padding: 10rpx;
					text-align: center;
					image {
						display: block;
						width: 40rpx;
						height: 40rpx;
					}
					text {
						display: block;
						line-height: 40rpx;
					}
				}
			}
		}
	}
</style>
